﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace GraphViewer.Configuration
{
    public class EnvironmentConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("dataBases", IsRequired = true)]
        [ConfigurationCollection(typeof(DataBaseConfigurationElement), AddItemName = "add")]
        public ConfigurationCollection<DataBaseConfigurationElement> DataBases
        {
            get
            {
                return (ConfigurationCollection<DataBaseConfigurationElement>)this["dataBases"];
            }
        }

        [ConfigurationProperty("systems", IsRequired = true)]
        [ConfigurationCollection(typeof(SystemConfigurationElement), AddItemName = "add")]
        public ConfigurationCollection<SystemConfigurationElement> Systems
        {
            get
            {
                return (ConfigurationCollection<SystemConfigurationElement>)this["systems"];
            }
        }

        public static EnvironmentConfigurationSection GetSection()
        {
            return (EnvironmentConfigurationSection)ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).GetSection("environmentConfiguration");
        }
    }
}
